define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {

        var Controller = {
            index: function () {
                // 初始化表格参数配置
                Table.api.init({
                    extend: {
                        index_url: 'user/withdraw/index' + location.search,
                        add_url: 'user/withdraw/add',
                        edit_url: 'user/withdraw/edit',
                        del_url: '',
                        multi_url: 'user/withdraw/multi',
                        import_url: 'user/withdraw/import',
                        table: 'user_withdraw',
                    }
                });

                var table = $("#table");

                // 初始化表格
                table.bootstrapTable({
                    url: $.fn.bootstrapTable.defaults.extend.index_url,
                    pk: 'id',
                    sortName: 'id',
                    fixedColumns: true,
                    fixedRightNumber: 1,
                    columns: [
                        [
                            {checkbox: true},
                            {field: 'id', title: __('Id')},
                            {field: 'user_id', title: __('User_id')},
                            {field: 'user.nickname', title: __('User.nickname'), operate: 'LIKE'},
                            {field: 'user.mobile', title: __('User.mobile'), operate: 'LIKE'},
                            {field: 'money', title: __('Money'), operate: 'BETWEEN'},
                            // {field: 'type', title: __('Type')},
                            // {field: 'card', title: __('Card'), operate: 'LIKE'},
                            // {field: 'money_id', title: __('Money_id')},
                            {
                                field: 'status', title: __('Status'),
                                formatter: Table.api.formatter.label,
                                searchList: {0: "申请中", 1: "已打款"}
                            },
                            // {field: 'refuse', title: __('Refuse'), operate: 'LIKE'},
                            {
                                field: 'createtime',
                                title: __('Createtime'),
                                operate: 'RANGE',
                                addclass: 'datetimerange',
                                autocomplete: false,
                                formatter: Table.api.formatter.datetime
                            },
                            {
                                field: 'updatetime',
                                title: __('Updatetime'),
                                operate: 'RANGE',
                                addclass: 'datetimerange',
                                autocomplete: false,
                                formatter: Table.api.formatter.datetime
                            },
                            {
                                field: 'operate',
                                title: __('Operate'),
                                table: table,
                                events: Table.api.events.operate,
                                formatter: Table.api.formatter.operate
                            }
                        ]
                    ]
                });

                // 为表格绑定事件
                Table.api.bindevent(table);
            },
            add: function () {
                Controller.api.bindevent();
            }
            ,
            edit: function () {
                Controller.api.bindevent();
            }
            ,
            api: {
                bindevent: function () {
                    Form.api.bindevent($("form[role=form]"));
                }
            }
        };
        return Controller;
    }
)
;
